package com.rc.saas.tenant.common.enums;

/**
 * Create by Yang on 2021/7/31
 */
public enum ShStopReasonEnum {

    SH_STOP_0(0, "正常结束", "BMS 主动停机"),
    SH_STOP_1(1, "接收 BMS 的辨识报文超时", "充电机主动停止"),
    SH_STOP_2(2, "接收电池充电参数报文超时", "充电机主动停止"),
    SH_STOP_3(3, "接收 BMS 完成充电准备报文超时", "充电机主动停止"),
    SH_STOP_4(4, "接收电池充总状态报文超时", "充电机主动停止"),
    SH_STOP_5(5, "接收电池充电需求报文超时", "充电机主动停止"),
    SH_STOP_6(6, "接收 BMS 中止充电报文超时", "充电机主动停止"),
    SH_STOP_7(7, "接收 BMS 充电统计报文超时", "充电机主动停止"),
    SH_STOP_20(20, "收到 bem 报文停止 BMS 报文错误", "充电机主动停止"),
    SH_STOP_21(21, "收到 bst 报文停止 BMS 发送 BST 报文   ", "主动停止"),
    SH_STOP_22(22, "收到 BSM 报文错误停止", "充电机主动停止"),
    SH_STOP_23(23, "BMS 温度过高异常BMS", "充电机主动停止"),
    SH_STOP_24(24, "单体电压过高异常BMS", "充电机主动停止"),
    SH_STOP_25(25, "需求电流异常", "充电机主动停止"),
    SH_STOP_30(30, "BST 的 SOC 目标值 BMS 发出 BST 报文 ", "BMS 主动停止"),
    SH_STOP_31(31, "BST 的电压设定值 BMS 发出 BST 报文  ", "BMS 主动停止"),
    SH_STOP_32(32, "BST 单体电压满 BMS 发出 BST 报文", "BMS 主动停止"),
    SH_STOP_33(33, "BST_00_6 BMS 发出 BST 报文，BMS", "主动停止"),
    SH_STOP_34(34, "BST 绝缘故障 BMS 发出 BST 报文，BMS ", "主动停止"),
    SH_STOP_35(35, "BST 连接器过温 BMS 发出 BST 报文", "主动停止"),
    SH_STOP_36(36, "BST 元件过温 BMS 发出 BST 报文，BMS ", "主动停止"),
    SH_STOP_37(37, "BST 连接器故障 BMS 发出 BST 报文，BMS ", "主动停止"),
    SH_STOP_38(38, "BST 电池组过温 BMS 发出 BST 报文，BMS ", "主动停止"),
    SH_STOP_39(39, "BST 其他故障 BMS 发出 BST 报文", "BMS 主动停止"),
    SH_STOP_40(40, "BST_02_4 BMS 发出 BST 报文，BMS", "主动停止"),
    SH_STOP_41(41, "BST_02_6 BMS 发出 BST 报文，BMS", "主动停止"),
    SH_STOP_42(42, "BST 电流过大 BMS 发出 BST 报文，BMS ", "主动停止"),
    SH_STOP_43(43, "BST 电压异常 BMS 发出 BST 报文，BMS ", "主动停止"),
    SH_STOP_200(200, "用户中止 用户操作停止", "充电机主动停止"),
    SH_STOP_201(201, "系统告警 1 控制板上报告警", "充电机主动停止"),
    SH_STOP_202(202, "系统告警 2 控制板上报告警", "充电机主动停止"),
    SH_STOP_300(300, "CC1 连接断开 CC1 断开", "充电机主动停止"),
    SH_STOP_301(301, "用户刷卡停止 用户刷卡停止", "充电机主动停止"),
    SH_STOP_302(302, "紧急停机 用户操作紧急按钮", "充电机主动停止"),
    SH_STOP_303(303, "预处理加电失败 充电卡锁定失败", "充电机主动停止"),
    SH_STOP_304(304, "绝缘检测异常 充电机主动停止", ""),
    SH_STOP_305(305, "控制板通讯异常 充电机主动停止", ""),
    SH_STOP_306(306, "充电电量达到设定值 充电机主动停止", ""),
    SH_STOP_307(307, "充电时间达到设定值 充电机主动停止", ""),
    SH_STOP_308(308, "充电金额达到设定值 充电机主动停止", ""),
    SH_STOP_309(309, "电表通讯异常 充电机主动停止", ""),
    SH_STOP_310(310, "充电金额超过用户卡余额充电机主动停止", ""),
    SH_STOP_311(311, "后台终止 收到后台关机指令", ""),
    SH_STOP_312(312, "系统告警中止 控制板上报系统故障", "充电机主动停止"),
    SH_STOP_313(313, "后台通讯中止 集中器通讯断开", "充电机主动停止"),
    SH_STOP_314(314, "充电电压异常中止", "充电机主动停止"),
    SH_STOP_315(315, "充电电流异常中止", "充电机主动停止"),
    SH_STOP_316(316, "BMS 的 SOC 满中止", "充电机主动停止"),
    SH_STOP_317(317, "电表电量异常增大中止", "充电机主动停止"),
    SH_STOP_318(318, "电表电量异常变小中止", ""),
    SH_STOP_319(319, "VIN 码不匹配 车辆 VIN 码与设定的不匹配", ""),
    SH_STOP_401(401, "管理员界面中止", ""),
    SH_STOP_402(402, "软件升级 系统软件进行升级，中止充电", ""),
    SH_STOP_403(403, "充电启动超时 启动充电时间 60 秒内没进入充电", ""),
    SH_STOP_404(404, "BMS 单体动力蓄电池电压异常车发送的 BSM 报文", ""),
    SH_STOP_405(405, "BMS 整车动力蓄电池荷电状态系统突然断电，   ", ""),
    SH_STOP_406(406, "BMS 动力蓄电池充电过电流", ""),
    SH_STOP_407(407, "BMS 动力蓄电池温度过高", ""),
    SH_STOP_408(408, "BMS 动力蓄电池绝缘状态", ""),
    SH_STOP_409(409, "BMS 蓄电池组输出连接器状", ""),
    SH_STOP_410(410, "充电电压超过 BMS 最大允许值", ""),
    SH_STOP_411(411, "BMS 其他位状态异常 车发送的 BSM 报文状态异常", ""),
    SH_STOP_412(412, "BCS 上传电压异常 BCS 报文上传电压或充电电压", ""),
    SH_STOP_413(413, "断网停止充电 网络断开后，充电电量达到设定值", ""),
    SH_STOP_414(414, "BSM 报文超时 充电中接收电池 BSM 报文超时", ""),
    SH_STOP_2000(2000, " 系统其他故障", "充电机主动停止"),
    SH_STOP_2001(2001, " 紧急停机故障", ""),
    SH_STOP_2002(2002, " 绝缘故障", ""),
    SH_STOP_2003(2003, " 直流过压 电池电压超过设置的过压保护值", ""),
    SH_STOP_2004(2004, " 直流欠压 充电电压低于充电机最低输出电压", ""),
    SH_STOP_2005(2005, " 软启失败", ""),
    SH_STOP_2006(2006, " 输出反接故障", ""),
    SH_STOP_2007(2007, " 接触器异常", ""),
    SH_STOP_2008(2008, " 模块故障", ""),
    SH_STOP_2009(2009, " 电网电压高", ""),
    SH_STOP_2010(2010, " 电网电压低", ""),
    SH_STOP_2011(2011, " 电网频率高", ""),
    SH_STOP_2012(2012, " 电网频率低", ""),
    SH_STOP_2013(2013, " 模块通信异常", ""),
    SH_STOP_2015(2015, " 模块类型不一致系统设置的模块类型与实际模块", ""),
    SH_STOP_2016(2016, " 系统辅源掉电 系统交流侧突然断电", ""),
    SH_STOP_2017(2017, " 直流输出断路 接触器没正常闭合 或熔断丝损坏", ""),
    SH_STOP_2018(2018, " 进风口过温保护", ""),
    SH_STOP_2019(2019, " 进风口低温保护", ""),
    SH_STOP_2020(2020, " 出风口过温保护", ""),
    SH_STOP_2021(2021, " 群充模块过温", ""),
    SH_STOP_2022(2022, " 防雷故障", ""),
    SH_STOP_100001(100001, "迪文通信告警 100000 以上故障为交流桩停止原因", ""),
    SH_STOP_100002(100002, "读卡器通信告警", ""),
    SH_STOP_100003(100003, "防雷器故障", ""),
    SH_STOP_100004(100004, "主开关及熔断器故障", ""),
    SH_STOP_100005(100005, "紧急停机故障", ""),
    SH_STOP_100032(100032, "电表 1 通信异常", ""),
    SH_STOP_100033(100033, "电表 2 通信异常", ""),
    SH_STOP_101000(101000, "断开连接", ""),
    SH_STOP_101001(101001, "未准备就绪", ""),
    SH_STOP_101002(101002, "充电过压 电池电压超过设置的过压保护值", ""),
    SH_STOP_101003(101003, "充电过流 充电电流超过设置的电流保护值", ""),
    SH_STOP_101004(101004, "充电欠压 充电电压低于充电机最低输出电压", ""),
    SH_STOP_101005(101005, "用户刷卡停止充电", ""),
    SH_STOP_101006(101006, "后台停止", ""),
    SH_STOP_101007(101007, "充电时间达到设定值 充电机主动停止", ""),
    SH_STOP_101008(101008, "充电金额达到设定值 充电机主动停止", ""),
    SH_STOP_101009(101009, "充电电量达到设定值 充电机主动停止", ""),
    SH_STOP_101010(101010, "应用软件升级停止 软件升级", ""),
    SH_STOP_101011(101011, "系统掉电停止 交流侧突然断电", ""),
    SH_STOP_101012(101012, "未知原因", ""),
    SH_STOP_101013(101013, "用户界面中止 在用户界面按停止充电按钮", ""),
    SH_STOP_101014(101014, "金额不足 充电卡或帐号余额不足", ""),
    SH_STOP_101015(101015, "电池充满", ""),
    SH_STOP_101016(101016, "达到用户设定充电条件", "");

    private int code;

    private String msg;

    private String detail;

    ShStopReasonEnum(int code, String msg, String detail) {
        this.code = code;
        this.msg = msg;
        this.detail = detail;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }


    /**
     * 解析code
     *
     * @param code
     * @return
     */
    public static String getStopReasonMsg(Integer code) {
        Class<ShStopReasonEnum> shStopReasonEnumClass = ShStopReasonEnum.class;
        for (ShStopReasonEnum enumConstant : shStopReasonEnumClass.getEnumConstants()) {
            if (enumConstant.getCode() == code) {
                return enumConstant.getMsg();
            }
        }
        return "未知故障码code:" + code;
    }


}
